function addCase() {
    var param = $("#caseForm").serialize();
    alert(param);
}
function showValue(e) {
      $(e).attr("name","illnessName");
        var a = $(e).parent().parent().next().find("input").val();
    var length = $(e).parent().prev().html();
    length=parseInt(length.substring(0,1))+1;
        if(typeof(a)=="undefined") {
            var addInput = '<div style="margin:10px 0;" class="form-group">\
            <label class="col-md-1 control-label text-right">1.</label>\
            <div class="col-md-7">\
            <input  style="margin-left:15px;" onfocus="showValue(this)" class="form-control" type="text"/>\
            </div>\
            </div>';
            $("#jiuzhen").append(addInput);
        }
     $(e).parent().parent().next().find("label").html(length+"、");
}
function showValue2(e) {
    $(e).attr("name","illnessResult");
    var a = $(e).parent().parent().next().find("input").val();
    if(typeof(a)=="undefined") {
        var addInput2 = '<div  class="form-group"  >\
            <div class="col-md-6" style="margin:10px 0;">\
            <input  style="margin-left:15px;" onfocus="showValue2(this)" class="form-control" type="text"/>\
            </div>\
            <div class="col-md-6" style="margin:10px 0;">\
            <button  class="btn btn-danger" type="button">删除</button>\
            </div>\
            </div>';
        $("#zhenduan").append(addInput2);
    }
}
$(function () {
       $.getJSON(ctx+"/therapists/xPart/searchXPart?_="+new Date().getTime(),{},function (part) {
           if(part!=null && part.length>0){
               $(part).each(function () {
                   var $dictionary = '<option value="'+this.dictionaryId+'">'+this.dictionary.dictKey+'</option>';
                   $(".xpart [name=dictionary]").append($dictionary);
               });
           }
       });
});



/*添加病例*/
function addCase() {
    var params = $("#caseForm").serialize();
    console.info(params);
    $.post(ctx+"/director/caseEnter/addCase",params,function (data) {
        swal({
            title:"信息提示！",
            text:data,
            type:"success",
            allowOutsideClick:false
        }).then(function () {
            location.href=ctx+"/director/caseEnter/searchTreatment";
        });
    });
}

$("#fucha").change(function() {
    var state = $(this).prop("checked");
    if(state==true){
        $("#fuchaDate").show();
        $("input[name=caseReview]").val(1);
    }else{
        $("#fuchaDate").hide();
        $("input[name=caseReview]").val(0);
    }
});
